import * as actionTypes from './constant';
import { getLeaseWithdrawalInfo,handleLeaseWithdrawalExamin } from '../../services';
import { message } from 'antd';

const changeLeaseWithdrawalInfo = (res) => ({
    type:actionTypes.CHANGE_LEASE_WITHDRAWAL_INFO,
    leaseWithdrawalInfo: res.data
})

export const getLeaseWithdrawalInfoAction = () => {
    return dispatch => {
        getLeaseWithdrawalInfo().then(res => {
            // console.log(res);
            dispatch(changeLeaseWithdrawalInfo(res));
        })
    }
}

export const handleLeaseWithdrawalExaminAction = (examinInfo) => {
    return dispatch => {
        handleLeaseWithdrawalExamin(examinInfo).then(res => {
            console.log(res.message);
            if(res.status == 200)
            {
                message.success(res.message)
            }else{
                message.error(res.message)
            }
        }).catch(err => {
            message.error(err)
        })
    }
}